package com.mairuide.phone;



import com.mairuide._frame.base.BaseModel;

import javax.persistence.*;
import java.lang.reflect.Method;
import java.math.BigDecimal;
import java.sql.Timestamp;

/**
 * @Auther: zyj
 * @Date: 2018/12/13 16:32
 * @Description:
 */
@Entity
@Table(name="TB_PHONE_RECORDING")
public class PhoneRecord extends BaseModel implements Cloneable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 3091848435825114567L;

	@Id
    @Column(name="RECORD_ID")
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "PHONE_RECORDING")
    @SequenceGenerator(name = "PHONE_RECORDING", sequenceName = "SEQ_PHONE_RECORDING",allocationSize=1)
    private Integer recordId;

    @Column(name="CASEMANAGE_ID")
    private String casemanageId;//案件管理主键

    @Column(name="CREATE_ID")
    private Integer createId;//创建人id

    @Column(name="CREATE_TIME")
    private Timestamp createTime;//创建时间

    @Column(name="IS_DELETE")
    private Integer isDelete;//是否删除

    @Column(name="BUSINESS_TYPE")
    private String businessType;//业务类型

    @Column(name="STARTING_TIME")
    private Timestamp startingTime;//起始时间

    @Column(name="SERVICE_NUMBER")
    private String serviceNumber;//服务号码

    @Column(name="SERVICE_USER_INFORMATION")
    private String serviceUserInformation;//服务号码用户信息

    @Column(name="SERVICE_LOCATION")
    private String serviceLocation;//服务号码归属地

    @Column(name="CARD_NUMBER")
    private String cardNumber;//卡号

    @Column(name="DEVICE_NUMBER")
    private String deviceNumber;//设备号码

    @Column(name="PARTY_NUMBER")
    private String partyNumber;//对方号码

    @Column(name="PARTY_USER_INFORMATION")
    private String partyUserInformation;//对方号码用户信息

    @Column(name="PARTY_LOCATION")
    private String partyLocation;//对方号码归属地

    @Column(name="TALK_TIME")
    private String talkTime;//通话时长：秒

    @Column(name="CALL_TYPE")
    private Integer callType;//呼叫类型0:主叫  1：被叫  2：短信发送 3：短信接收  '

    @Column(name="LAC")
    private String lac;//LAC

    @Column(name="CID")
    private String cid;//CID

    @Column(name="BASE_STATION")
    private String baseStation;//服务号基站

    @Column(name="MSC")
    private String msc;//MSC

    @Column(name="CITY")
    private String city;//城市

    @Column(name="THIRD_NUMBER")
    private String thirdNumber;//第三方号码

    @Column(name="THIRD_NUMBER_INFORMATION")
    private String thirdNumberInformation;//第三方号码用户信息

    @Column(name="THIRD_NUMBER_LOCATION")
    private String thirdNumberLocation;//第三方号码归属地

    @Column(name="OPERATOR_CODE")
    private String operationCode;//漫游城市或运营商代码

    @Column(name="OPERATOR_CODE_INFORMATION")
    private String operationCodeInformation;//漫游城市或运营商代码信息

    @Column(name="BUSINESS_KEY")
    private String businessKey;//业务键

    @Column(name="ID_NUMBER")
    private String idNumber;//身份证号

    @Column(name="UUID")
    private String uuid;//文件标识

    @Column(name="LNGB")
    private String lngb;//百度经度
    @Column(name="ADDRESS")
    private String address;//地址
    @Column(name="LATB")
    private String latb;//百度纬度

    public String getUuid() {
        return uuid;
    }

    public void setUuid(String uuid) {
        this.uuid = uuid;
    }

    public String getIdNumber() {
        return idNumber;
    }

    public void setIdNumber(String idNumber) {
        this.idNumber = idNumber;
    }

    public Integer getRecordId() {
        return recordId;
    }

    public void setRecordId(Integer recordId) {
        this.recordId = recordId;
    }

    public String getCasemanageId() {
        return casemanageId;
    }

    public void setCasemanageId(String casemanageId) {
        this.casemanageId = casemanageId;
    }

    public Integer getCreateId() {
        return createId;
    }

    public void setCreateId(Integer createId) {
        this.createId = createId;
    }

    public Timestamp getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Timestamp createTime) {
        this.createTime = createTime;
    }

    public Integer getIsDelete() {
        return isDelete;
    }

    public void setIsDelete(Integer isDelete) {
        this.isDelete = isDelete;
    }

    public String getBusinessType() {
        return businessType;
    }

    public void setBusinessType(String businessType) {
        this.businessType = businessType;
    }

    public Timestamp getStartingTime() {
        return startingTime;
    }

    public void setStartingTime(Timestamp startingTime) {
        this.startingTime = startingTime;
    }

    public String getCardNumber() {
        return cardNumber;
    }

    public void setCardNumber(String cardNumber) {
        this.cardNumber = cardNumber;
    }

    public String getDeviceNumber() {
        return deviceNumber;
    }

    public void setDeviceNumber(String deviceNumber) {
        this.deviceNumber = deviceNumber;
    }

    public String getTalkTime() {
        return talkTime;
    }

    public void setTalkTime(String talkTime) {
        this.talkTime = talkTime;
    }

    public Integer getCallType() {
        return callType;
    }

    public void setCallType(Integer callType) {
        this.callType = callType;
    }

    public String getLac() {
        return lac;
    }

    public void setLac(String lac) {
        this.lac = lac;
    }

    public String getCid() {
        return cid;
    }

    public void setCid(String cid) {
        this.cid = cid;
    }

    public String getBaseStation() {
        return baseStation;
    }

    public void setBaseStation(String baseStation) {
        this.baseStation = baseStation;
    }

    public String getMsc() {
        return msc;
    }

    public void setMsc(String msc) {
        this.msc = msc;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public String getThirdNumber() {
        return thirdNumber;
    }

    public void setThirdNumber(String thirdNumber) {
        this.thirdNumber = thirdNumber;
    }

    public String getThirdNumberInformation() {
        return thirdNumberInformation;
    }

    public void setThirdNumberInformation(String thirdNumberInformation) {
        this.thirdNumberInformation = thirdNumberInformation;
    }

    public String getThirdNumberLocation() {
        return thirdNumberLocation;
    }

    public void setThirdNumberLocation(String thirdNumberLocation) {
        this.thirdNumberLocation = thirdNumberLocation;
    }

    public String getOperationCode() {
        return operationCode;
    }

    public void setOperationCode(String operationCode) {
        this.operationCode = operationCode;
    }

    public String getOperationCodeInformation() {
        return operationCodeInformation;
    }

    public void setOperationCodeInformation(String operationCodeInformation) {
        this.operationCodeInformation = operationCodeInformation;
    }

    public String getBusinessKey() {
        return businessKey;
    }

    public void setBusinessKey(String businessKey) {
        this.businessKey = businessKey;
    }

    public String getServiceNumber() {
        return serviceNumber;
    }

    public void setServiceNumber(String serviceNumber) {
        this.serviceNumber = serviceNumber;
    }

    public String getServiceUserInformation() {
        return serviceUserInformation;
    }

    public void setServiceUserInformation(String serviceUserInformation) {
        this.serviceUserInformation = serviceUserInformation;
    }

    public String getServiceLocation() {
        return serviceLocation;
    }

    public void setServiceLocation(String serviceLocation) {
        this.serviceLocation = serviceLocation;
    }

    public String getPartyNumber() {
        return partyNumber;
    }

    public void setPartyNumber(String partyNumber) {
        this.partyNumber = partyNumber;
    }

    public String getPartyUserInformation() {
        return partyUserInformation;
    }

    public void setPartyUserInformation(String partyUserInformation) {
        this.partyUserInformation = partyUserInformation;
    }

    public String getPartyLocation() {
        return partyLocation;
    }

    public void setPartyLocation(String partyLocation) {
        this.partyLocation = partyLocation;
    }
    @Override   
    protected PhoneRecord clone() {   
    	PhoneRecord clone = null;   
        try{   
            clone = (PhoneRecord) super.clone();   
              
        }catch(CloneNotSupportedException e){   
            throw new RuntimeException(e);  // won't happen   
        }   
          
        return clone;   
    }
    public void setValue(Object obj,Class<?> clazz,String filedName,Class<?> typeClass,Object value){
        String methodName = "set" + filedName.substring(0,1).toUpperCase()+filedName.substring(1);
        try{
            Method method =  clazz.getDeclaredMethod(methodName, new Class[]{typeClass});
            method.invoke(obj, new Object[]{getClassTypeValue(typeClass, value)});
        }catch(Exception ex){
            ex.printStackTrace();
        }
    }

    private Object getClassTypeValue(Class<?> typeClass, Object value){
        if(typeClass == int.class  || value instanceof Integer){
            if(null == value){
                return 0;
            }
            return value;
        }else if(typeClass == short.class){
            if(null == value){
                return 0;
            }
            return value;
        }else if(typeClass == byte.class){
            if(null == value){
                return 0;
            }
            return value;
        }else if(typeClass == double.class){
            if(null == value){
                return 0;
            }
            return value;
        }else if(typeClass == long.class){
            if(null == value){
                return 0;
            }
            return value;
        }else if(typeClass == String.class){
            if(null == value){
                return "";
            }
            return value;
        }else if(typeClass == boolean.class){
            if(null == value){
                return true;
            }
            return value;
        }else if(typeClass == BigDecimal.class){
            if(null == value){
                return new BigDecimal(0);
            }
            return new BigDecimal(value+"");
        }else {
            return typeClass.cast(value);
        }
    }
    /**
     * 处理字符串  如：  abc_dex ---> abcDex
     * @param str
     * @return
     */
    public  String removeLine(String str){
        if(null != str && str.contains("_")){
            int i = str.indexOf("_");
            char ch = str.charAt(i+1);
            char newCh = (ch+"").substring(0, 1).toUpperCase().toCharArray()[0];
            String newStr = str.replace(str.charAt(i+1), newCh);
            String newStr2 = newStr.replace("_", "");
            return newStr2;
        }
        return str;
    }

    public String getLngb() {
        return lngb;
    }

    public void setLngb(String lngb) {
        this.lngb = lngb;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getLatb() {
        return latb;
    }

    public void setLatb(String latb) {
        this.latb = latb;
    }
}
